package com.czl.elm.dao;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.czl.elm.domain.RedParper;
import com.czl.elm.domain.RedShopParper;
import com.czl.elm.domain.Seckill;
import org.apache.ibatis.annotations.Mapper;

import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
@Repository
public interface RedParperMapper {


    List<RedShopParper> getRandomRedShopParper(Integer type);

    Integer saveCreateRedParper(RedParper redParper);

    int addShopRedParper(RedShopParper redShopParper);

    IPage<RedParper> getHistoryRedParper(String phoneName, Page<RedParper> page, LocalDateTime now);

    List<RedParper> getNoUseRedParper(String phoneName, Integer shopId, Integer cost, LocalDateTime now);

    List<RedParper> getUseRedParper(String phoneName, Integer shopId, Integer cost, LocalDateTime now);

    IPage<RedParper> getAllRedParper(String phoneName, Page<RedParper> page, LocalDateTime now);

    Long getAllRedParperNumber(String phoneName, LocalDateTime now);

    Long getUseRedParperNumber(String phoneName, Integer shopId, Integer cost, LocalDateTime now);

    Long getNoUseRedParperNumber(String phoneName, Integer shopId, Integer cost, LocalDateTime now);

    Integer getFirstLoginToday(String phoneName);

    Integer getSeckillNumber(String redParperId);

    int getCheckSeckill(String phoneName, String redShopParperId);

    RedShopParper getRedShopParperById(String redShopParperId);

    void addSeckillParper(Seckill seckill);

    Seckill getSeckillById(String redShopParperId);

    List<String> seckillListbyuser(String phoneName, LocalDateTime killTime);

    IPage<RedParper> getRecentRedParper(String phoneName, Page<RedParper> page, LocalDateTime now, LocalDateTime beforeday);

    IPage<RedParper> getWillExpireRedParper(String phoneName, Page<RedParper> page, LocalDateTime now, LocalDateTime afterday);

    IPage<Seckill> seckillList(LocalDateTime now, LocalDateTime time, Page<RedParper> page);

    Integer doSeckill(String seckillId);

    RedParper getredParperById(String redParperId);

    List<Seckill> getAllSeckill(LocalDateTime now);

    String getSeckillResult(String phoneName, String seckillId);

    Integer getSeckillNum(String seckillId);
}
